#include <iostream>
using namespace std;

bool gcd(int x, int y){
    return x ? gcd(y % x, x) : y;    
}

//开始总共只有两种倒法，十升向7升的到，十升向3升的到，然后不回倒，下一步倒向另一个，直到有解为止
int pull(int m, int n) {
	int ten = m + n, a = 0, b = 0; //每一个壶的初始升数,a，b代表两个壶，当m为3时，a为3L壶；m为7时，a为7L壶
	int total = 0;
	cout << total ++ << ": " << ten << " " << a << " " << b << endl;
	while(ten != m + n >> 1){
	    if(a == 0){
	        //当m为3时，a为3L壶；m为7时，a为7L壶
	        ten -= m;
	        a += m;
	        cout << total ++ << ": " << ten << " " << a << " " << b << endl;
	    }
	    if(a > 0 && b < n){
	        //判断m是7还是n是7，及b=7时能否给满
	        if(a + b <= n){
	            b += a;
	            a -= a;
	            cout << total ++ << ": " << ten << " " << a << " " << b << endl;
	        } 
	        else {
	            a -= n - b;
	            b = n;
	            cout << total ++ << ": " << ten << " " << a << " " << b << endl;
	        }
	    }
	    if(b == n){
	        b -= n;
	        ten += n;
	        cout << total ++ << ": " << ten << " " << a << " " << b << endl;
	    }
	    
	    if(m >= n && a == m + n >> 1)break;
	    if(m <= n && b == m + n >> 1)break;
	}
} 

void text1(){
    int m = 7, n = 3;
    if(!(m + n) % gcd(m , n) || (m + n) & 1){
        cout << "None" << endl;
        return ;
    }
	int min1, min2;
	cout << "第 1 种方案：" << endl;
	min1 = pull(m , n);
	cout << "------------------------" << endl;
	cout << "第 2 种方案：" << endl; 
	min2 = pull(n , m);
	cout << "------------------------" << endl;
	if (min1 > min2)
		cout << "第 2 种方案步骤最少。" << endl; 
	else cout << "第 1 种方案步骤最少。"; 
	return ; 
}

int main() { 
    text1();
    return 0;
}
